//
//  AgreementViewController.m
//  NiuBanJinGold
//
//  Created by Billy on 15/10/13.
//  Copyright © 2015年 zzjr. All rights reserved.
//

#import "AgreementViewController.h"

@interface AgreementViewController () <UIWebViewDelegate>

@end

@implementation AgreementViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSLog(@"%@" , GETCURRENTUSERINOBYPRAMETERES(user_userId));
    [self pageSettingsAndSubviewsCreationWithMemberId:GETCURRENTUSERINOBYPRAMETERES(user_userId) Token:GETCURRENTUSERINOBYPRAMETERES(user_userToken)];
}


#pragma mark - SubviewsCreationAndPageSettings

- (void) pageSettingsAndSubviewsCreationWithMemberId:(NSString *)memberId Token:(NSString *)token {
    
    [self.view setBackgroundColor:[UIColor whiteColor]];
    
    [self.navigationItem setTitle:@"协议内容"];
    
    UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - MULTIPLYHEIGHT(60.0))];
    [webView setScalesPageToFit:YES];
    [MBProgressHUD showHUDAddedTo:webView animated:YES];
    [webView setDelegate:self];
    NSString *str_url =  [NSString stringWithFormat:@"http://style.niubangold.com/app/nqb_financial_agreement.app.html?memberId=%@&token=%@" ,memberId ,token];
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: str_url]]];
    [self.view addSubview:webView];
}

- (void)webViewDidStartLoad:(UIWebView *)webView {
    
    
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
    
    [MBProgressHUD hideAllHUDsForView:webView animated:YES];
    
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(nullable NSError *)error {
    
    [MBProgressHUD hideAllHUDsForView:self.view animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
